import 'package:canteen/class/dish.dart';
import 'package:canteen/class/ingredient.dart';
import 'package:canteen/class/set_meal.dart';

Dish? findDishByName(String targetName, List<Dish> dishList) {
  try {
    return dishList.firstWhere((dish) => dish.name == targetName);
  } catch (e) {
    return null;
  }
}

SetMeal? findSetMealByName(String targetName, List<SetMeal> setMealList) {
  try {
    return setMealList.firstWhere((setMeal) => setMeal.name == targetName);
  } catch (e) {
    return null;
  }
}

// Ingredient? findIngredientByAllProperty(String targetName, String type, String unit,
//     List<Ingredient> ingredientList) {
//   try {
//     return ingredientList.firstWhere((ingredient) =>
//         ingredient.name == targetName &&
//         ingredient.type == type &&
//         ingredient.unit == unit);
//   } catch (e) {
//     return null;
//   }
// }
